import axios from 'axios'//引入axios
import Vue from 'vue'
//顶部进度条
import Nprogress from 'nprogress'
import 'nprogress/nprogress.css'

export default function(){
  // axios.defaults.baseURL = 'http://timemeetyou.com:8889/api/private/v1/'
  // axios.defaults.baseURL = 'http://127.0.0.1:8889/api/private/v1/'
   axios.defaults.baseURL = 'http://81.68.218.170:8001/api/private/v1/'

  axios.interceptors.request.use(config =>{
    config.headers.Authorization = window.sessionStorage.getItem('token')
    //在request拦截器中展示进度条
    Nprogress.start()
    return config
  })
  axios.interceptors.response.use(config =>{
    //在response拦截器中隐藏进度条
    Nprogress.done()
    return config
  })
  Vue.prototype.$http = axios
}
